package com.woniu.dao;

import com.woniu.entity.User;
import com.woniu.entity.UserExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

@Repository
public interface UserMapper {
    long countByExample(UserExample example);

    int deleteByExample(UserExample example);

    int deleteByPrimaryKey(Integer id);

    int insert(User record);

    int insertSelective(User record);

    List<User> selectByExample(UserExample example);

    User selectByPrimaryKey(Integer id);

    int updateByExampleSelective(@Param("record") User record, @Param("example") UserExample example);

    int updateByExample(@Param("record") User record, @Param("example") UserExample example);

    int updateByPrimaryKeySelective(User record);

    int updateByPrimaryKey(User record);

    @Select("select p.percode\n" +
            "from rbac_perms p\n" +
            "\t\t\t\t\t\t\t\tinner join rbac_user_perm up on(p.id=up.permid)\n" +
            "\t\t\t\t\t\t\t\tinner join rbac_user u on(u.id=up.userid)\n" +
            "where u.username=#{username}")
    List<String> selectPercodeByPerm(String username);
}